package com.zx.email.service.Impl;

import Email.Dto.EmailDto;
import com.zx.email.mapper.EmailMapper;
import com.zx.email.service.EmailService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class EmailServiceImpl implements EmailService {
    private final EmailMapper emailMapper;

    @Override
    public List<EmailDto> findALlByCompanyId(Integer companyId) {
        return emailMapper.findAllByCompanyId(companyId);
    }

    @Override
    public List<EmailDto> findALlByUserId(Integer userId) {
        return emailMapper.findAllByUserId(userId);
    }

    @Override
    public void sendEmail(EmailDto emailDto) {
        emailMapper.sendEmail(emailDto);
    }

    @Override
    public void setRead(Integer id) {
        emailMapper.setRead(id);
    }
}
